<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="com.ereport.entity.DailyActivity"%>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="<%=application.getContextPath() %>/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-1.6.min.js"></script>	
<script language="javascript" src="<%=application.getContextPath() %>/js/calendar_eu.js"></script>
<script type="text/javascript" src="<%=application.getContextPath() %>/js/jquery-ui-1.8.17.custom.min.js"></script>	
<link rel="stylesheet" href="<%=application.getContextPath() %>/css/jquery-ui-1.8.17.custom.css"/>
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.js"></script>	
<script type="text/javascript" src="<%=application.getContextPath()%>/js/jquery.validate.min.js"></script>
<script>

	$(function() {
		$( "#dueDate" ).datepicker({ dateFormat: "dd-mm-yy" });
	});
	</script>
 <style>
  	#field, label { float: left; font-family: Arial, Helvetica, sans-serif; font-size: 11px; }
  	label {  width: 14em; }
	br { clear: both; }
	input.error { border: 1px solid red;  }
	select.error{ border: 1px solid red;  }
	label.error {
		padding-left: 16px;
		margin-left: .3em;
		color: red;
		
	}
	.textfield{
		height: 22px;
		width: 180px;
		text-align: center; 
	}
	.tdinput{
		text-align: center;
	}
</style>

</head>
<script>
  $(document).ready(function(){
    $("#myform").validate({
  messages: {
	  org:
      {
          required: "Organisation must not be empty.",
      },
	  divi:
      {
          required: "Division must not be empty.",
      },
	  user:
      {
          required: "Name of the User must not be empty.",
      },
	  dueDate:
      {
          required: "Due Date must not be empty.",
      },
	  enqtype:
      {
          required: "Enquiry Type must not be empty.",
      },
	  exeName:
      {
          required: "Executive Name must not be empty.",
      }
   
  }
});
  });
  </script>
  
<body>
<form action="<%=application.getContextPath() %>/opportunity/save.do" method="post" name="myform" id="myform">
<table width="927" style="height:880px" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="116" align="left" valign="top" background="<%=application.getContextPath() %>/images/top-bg.jpg" style="background-repeat:repeat-x; background-position:left top">
    <%@ include file="common/exe-header.jsp" %>
    </td>
  </tr>
  <tr>
    <td  align="left" valign="top"><table width="927" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="20">&nbsp;</td>
        <td width="643" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
              <td align="left" valign="top">&nbsp;<a href="<%=application.getContextPath() %>/user/open.do"><img src="<%=application.getContextPath() %>/images/home1.jpg" width="20" height="20" border="0" /></a></td>
              <td width="8%" align="center"><a href="<%=application.getContextPath() %>/user/logout.do" style="font-family: sans-serif;">&nbsp;&nbsp;Logout</a></td>
            </tr>
          </table>
        </td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td width="20">&nbsp;</td>
        <td align="center" valign="top" class="heading">New Enquiry </td>
        <td width="20">&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="right"></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td align="center" valign="top"><table width="870" border="0" cellspacing="0" cellpadding="0">
       <tr>
            <td align="left" valign="top">
           <table width="895" border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
                <td><table width="100%" border="0" cellpadding="0" cellspacing="0" class="box-border1">
                  <tr>
                    <td width="366"><table width="348" border="0" align="center" cellpadding="0" cellspacing="0">
                        <tr>
                          <td width="14">&nbsp;</td>
                          <td width="124">&nbsp;</td>
                          <td width="199">&nbsp;</td>
                          <td width="11">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="28">&nbsp;</td>
                          <td align="left" valign="top" class="content">Organisation Name</td>
                          <td align="left" valign="top">
                          <%
                          String or="";
                          String div="";
                          String contpers="";
                          int daid=0;
                          DailyActivity da=(DailyActivity)request.getAttribute("dact");
                          if(da!=null){
                        	  daid=da.getId();
                           	  or=da.getOrganisation();
                           	  div=da.getDivision();
                           	  contpers=da.getContPerson();
                          }
                          
                          %>
                          <input type="hidden" name="dactid" id="dactid" value="<%=daid %>"/>
                          
                          <input type="text" name="org" id="org" class="textfield required"  value="<%=or %>" /></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Name Of User </td>
                          <td align="left" valign="top">
                          <input type="text" name="user" id="user" class="textfield required" value="<%=contpers %>"/></td>
                          <td align="left" valign="top">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Due Date </td>
                          <td align="left" valign="top">
                          <input name="dueDate" id="dueDate" type="text" class="textfield required" value="" /></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Project Name </td>
                          <td align="left" valign="top"><input name="prjname" type="text" class="textfield" value="" /></td>
                          <td align="left" valign="top">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" height="28" class="content">Opportunity Name </td>
                          <td align="left" valign="top"><input name="opprname" type="text" class="textfield" value="" /></td>
                          <td align="left" valign="top">&nbsp;</td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td height="5" align="left" valign="top"></td>
                          <td align="left" valign="top"></td>
                        </tr>
                       
                        <tr>
                          <td height="28">&nbsp;</td>
                          <td class="content">Quote Currence </td>
                          <td><select name="curr" class="textfield">
                              <option value="Please Select">Please Select</option>
                              <option value="Rs.">Rs.</option>
                              <option value="Dollar">$</option>
                              <option value="Singapore Dollar">S$</option>
                              <option value="Euro">Euro</option>
                              <option value="Yen">Yen</option>
                              <option value="Pound">Pound</option>
                          </select></td>
                          <td>&nbsp;</td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                    </table></td>
                    <td width="330" align="left" valign="top"><table width="348" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                          <td height="21">&nbsp;</td>
                          <td width="100">&nbsp;</td>
                          <td width="190">&nbsp;</td>
                        </tr>
                        <tr>
                          <td >&nbsp;</td>
                          <td align="left" height="28" valign="top" class="content">Division</td>
                          <td align="left" valign="top">
                          <input type="text" name="divi" id="divi" class="textfield required" value="<%=div %>"/></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" height="28" valign="top" class="content">Enquiry Type </td>
                          <td align="left" valign="top"><select name="enqtype" class="textfield required">
                              <option value="">Please Select</option>
                              <option value="TE">Tender Enquiry(TE)</option>
                              <option value="CP">Cash Purchase(CP)</option>
                              <option value="BQ">Budgetary Quotation(BQ)</option>
                          </select></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td align="left" valign="top" class="content">Bid Type </td>
                          <td align="left" valign="top"><table width="70%" border="0" cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="19%"><input type="checkbox" name="techbid" value="0" />                                </td>
                                <td width="81%" height="28" class="content">Technical Bid </td>
                              </tr>
                              <tr>
                                <td height="5"></td>
                                <td height="5" class="content"></td>
                              </tr>
                              <tr>
                                <td><input type="checkbox" name="pricebid" value="0" /></td>
                                <td height="28" class="content">Price Bid </td>
                              </tr>
                          </table></td>
                        </tr>
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                        </tr>
                        <tr>
                          <td>&nbsp;</td>
                          <td class="content" height="28">Executive Name </td>
                          <%
                          String exeName="";
                          if(da!=null){
                        	  exeName=da.getExeId().getExeName();
                          }
                          %>
                          <td><input name="exeName" type="text" class="textfield required" value="<%=exeName %>" /></td>
                        </tr>
                        <!-- <tr>
                          <td>&nbsp;</td>
                          <td align="left" height="28" valign="top" class="content">Probability </td>
                          <td align="left" valign="top">
                          <select name="prob" class="textfield">
                              <option value="0">0%</option>
                              <option value="50">50%</option>
                              <option value="90">90%</option>
                          </select>                          </td>
                        </tr> -->
                        <tr>
                          <td height="5"></td>
                          <td height="5" align="left" valign="top" class="content"></td>
                          <td height="5" align="left" valign="top"></td>
                        </tr>
                        
                        
                        <tr>
                          <td>&nbsp;</td>
                          <td class="content">&nbsp;</td>
                          <td>&nbsp;</td>
                        </tr>
                    </table></td>
                  </tr>
                </table></td>
              </tr>
              <tr>
                <td height="10" align="left" valign="top"></td>
              </tr>
              
              <tr>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td><table width="892" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#787878"  class="tablebox" id="iTable" >
                  <tr style="background:url('<%=application.getContextPath() %>/images/hed-bg-block-2.jpg'); background-repeat:repeat-x; background-position:left top">
                    <td width="24" height="40" align="left" valign="middle"  class="hed"  style="background-repeat:repeat-x">&nbsp;</td>
                    <td width="33" height="30" align="center" valign="middle"  class="hed"  style="background-repeat:repeat-x">S.No</td>
                    <td width="173" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF"> Part No </td>
                    <td width="55" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF"> Quantity </td>
                    <td width="129" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF">Make</td>
                    <td width="139" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF">Description</td>
                    <td width="135" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF">Application</td>
                    <td width="131" align="center" valign="middle"  class="hed"   style="background-repeat:repeat-x;bgcolor="#FFFFFF">Specification</td>
                  </tr>
                  <tr>
                    <td bgcolor="#cccccc"><input type="checkbox" name="checkbox" value="checkbox" /></td>
                    <td bgcolor="#cccccc" align="center">1</td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="prtno1" id="prtno1"  type="text" value="" size="5"  class="tdinput"/></td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="qnty1" id="qnty1" type="text" value="" size="5" class="tdinput"/></td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="make1" id="make1" type="text" value="" size="5" class="tdinput"/></td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="decri1" id="decri1" type="text" value="" size="5" class="tdinput"/></td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="applic1" id="applic1" type="text" value="" size="5" class="tdinput"/></td>
                    <td align="left" valign="top" bgcolor="#cccccc"><input name="spec1" id="spec1" type="text" value="" size="5" class="tdinput"/></td>
                  </tr>
                 
                </table></td>
              </tr>
              <tr>
                <td height="5"></td>
              </tr>
            </table>                       </td>
  </tr>
         
          <tr>
            <td height="10" align="left" valign="top">&nbsp;</td>
          </tr>
          <tr>
            <td align="left" valign="top"><div class="buttton-main">
              <input type="reset" class="button-black-right" value="Clear"/>
	        <input type="submit" class="button-black-right" value="Save"/>
			
          <div class="button-black-right" onclick="deleteRow('iTable')">Delete Row</div>
		  <div class="button-black-right" onclick="addRow('iTable')"> Add Row</div>
          </div>       
          <input type="hidden" name="rCount" id="rCount" value="1" />
             </td>
          </tr>
          <tr>
            <td height="10"></td>
          </tr>
          <tr>
            <td align="right" valign="top">&nbsp;</td>
          </tr>
          
          <tr>
            <td align="left" valign="top">&nbsp;</td>
          </tr>
        </table></td>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      
    </table></td>
  </tr>
  <tr>
    <td height="40" align="left" valign="top" bgcolor="#0B0B0B">&nbsp;</td>
  </tr>
</table>
</form>
</body>
</html>
<script language="javascript">
	var newRowCount=1;
        function addRow(iTable) {
 
            var table = document.getElementById(iTable);
 			var rowCount = table.rows.length;
			var row = table.insertRow(rowCount);
			
			var cell1 = row.insertCell(0);
			cell1.setAttribute("bgColor","#cccccc");
			var element1 = document.createElement("input");
            element1.type = "checkbox";
            cell1.appendChild(element1);
 
            var cell2 = row.insertCell(1);
			cell2.setAttribute("bgColor","#cccccc");
			cell2.align="center";
            cell2.innerHTML = rowCount ;
 
            var cell3 = row.insertCell(2);
            cell3.setAttribute("bgColor","#cccccc");
			cell3.innerHTML='<input name="prtno'+(newRowCount+1)+'" id="pno'+(newRowCount+1)+'" type="text" class="tdinput"  value="" size="5" />';
						
			var cell4 = row.insertCell(3);
			cell4.setAttribute("bgColor","#cccccc");
			cell4.innerHTML='<input name="qnty'+(newRowCount+1)+'" id="qnty'+(newRowCount+1)+'" type="text" class="tdinput" value="" size="5" />';
		   		
			var cell5 = row.insertCell(4);
			cell5.setAttribute("bgColor","#cccccc");
			cell5.innerHTML='<input name="make'+(newRowCount+1)+'" id="make'+(newRowCount+1)+'" type="text" class="tdinput" value="" size="5" />';
						
			var cell6 = row.insertCell(5);
			cell6.setAttribute("bgColor","#cccccc");
			cell6.innerHTML='<input name="decri'+(newRowCount+1)+'" id="decri'+(newRowCount+1)+'" type="text" class="tdinput" value="" size="5" />';
						
			 var cell7 = row.insertCell(6);
			 cell7.setAttribute("bgColor","#cccccc");
			cell7.innerHTML='<input name="applic'+(newRowCount+1)+'" id="applic'+(newRowCount+1)+'" type="text" class="tdinput" value="" size="5" />';
						
			var cell8 = row.insertCell(7);
			 cell8.setAttribute("bgColor","#cccccc");
			cell8.innerHTML='<input name="spec'+(newRowCount+1)+'" id="spec'+(newRowCount+1)+'" type="text" class="tdinput" value="" size="5" />';
			
			newRowCount++;
	        $("#rCount").val(newRowCount);
			 }
 
        function deleteRow(iTable) {
            try {
            var table = document.getElementById(iTable);
            var rowCount = table.rows.length;
 
            for(var i=0; i<rowCount; i++) {
                var row = table.rows[i];
                var chkbox = row.cells[0].childNodes[0];
                if(null != chkbox && true == chkbox.checked) {
                    table.deleteRow(i);
                    rowCount--;
                    i--;
                }
 
            }
			for(var i=0; i<rowCount-1; i++)

           table.rows[i+1].cells[1].innerHTML = i+1;
            }catch(e) {
                alert(e);
            }
        }
 
    </script>